﻿@model NCP.Recruiting.WebApp.Models.JobPositionFormModel
@using NCP.Recruiting.ApplicationServices.Shared;
@using Newtonsoft.Json
<script type="text/javascript">
    $(document).ready(function () {
        if ($('#ddlDateRage:visible').length != 0) {
            $('#ddlDateRage').bind('change', function () {
                displayValidDate();
            });
            displayValidDate();
        }

        $('#ddlDepartmentId').bind('change', function () {
            $('#chkUseDepartmentAddress').prop('checked', false);
        });

        $('#chkUseDepartmentAddress').bind('click', function () {
            if ($(this).prop('checked')) {
                displayDepartmentInfo();
            }
        });

        $('#ddlCategory').bind('change', function () {
            var selectedItem = $('#ddlCategory option:selected');
            if (selectedItem.attr('value') != '') {
                $('#txtJobTitle').val($.trim(selectedItem.text()));
            }
        });
    });

    function displayDepartmentInfo() {
        if ($('#ddlDepartmentId').val() != '') {
            var depobj = $.parseJSON($('#ddlDepartmentId option:selected').attr('depobj'));
            $('#txtContact').val(depobj.Contact);
            $('#txtTel').val(depobj.Tel);
            $('#txtFax').val(depobj.Fax);
            $('#txtEmail').val(depobj.Email);
        }
    }

    function displayValidDate() {
        var date = new Date();
        date.setDate(date.getDate() + parseInt($('#ddlDateRage').val()));
        $('#lblValidDate').text(date.format("yyyy/MM/dd"));
    }
</script>
<div id="wrap">
    <div class="wrapContents">
        <h1>
            @ViewBag.Title
        </h1>
        <div class="zwms">
            <div class="zwms_title">
                职位描述
            </div>
            <div class="zwms_box">
                <p>
                    <font>*</font><label>职位类别：</label><select id="ddlCategory" name="Category" class="@(ViewBag.CategoryError == true ? "input-validation-error zwlb_select" : "zwlb_select")" data-val="true" data-val-required="请填写职位类别">
                        <option value="">请选择</option>
                        @foreach (var item in Model.CategoryList)
                        {
                            <optgroup label="@item.Name">
                                <!--循环显示子类-->
                                @foreach (var subItem in Model.SubCategoryList.Where(x => x.ParentId.Value.Equals(item.Id)))
                                {
                                    <option value="@subItem.Value" @(Model.Category.Equals(subItem.Value) ? "selected" : "")>
                                        @subItem.Name
                                    </option>
                                }
                            </optgroup>
                        }
                    </select>
                    @Html.ValidationMessageFor(model => model.Category)
                </p>
                <p>
                    <font>*</font><label>职位名称：</label>@Html.TextBoxFor(model => model.JobTitle, new { @class = "work_input", id = "txtJobTitle" }) @Html.ValidationMessageFor(model => model.JobTitle)
                    <label>
                        职位排序:
                    </label>@Html.TextBoxFor(model => model.SortOrder, new { @class = "number" })@Html.ValidationMessageFor(model => model.SortOrder)
                </p>
                <p>
                    <font>*</font><label>工作地区：</label>
                    <select id="Location" name="Location" class="@(ViewBag.LocationError == true ? "input-validation-error workArea" : "workArea")" data-val="true" data-val-required="请填工作地区">
                        <option value="">请选择</option>
                        @foreach (var item in Model.LocationList)
                        {
                            <optgroup label="@item.Name">
                                <!--循环显示子类-->
                                @foreach (var subItem in Model.SubLocationList.Where(x => x.ParentId.Value.Equals(item.Id)))
                                {
                                    <option value="@subItem.Value" @(Model.Location.Equals(subItem.Value) ? "selected" : "")>
                                        @subItem.Name
                                    </option>
                                }
                            </optgroup>
                        }
                    </select>
                    @Html.ValidationMessageFor(model => model.Location)
                    @if (Model.CompanyInfo.IsAllowUseDepartmentAddress)
                    {
                        <label>
                            招聘部门：
                        </label><select id="ddlDepartmentId" name="DepartmentId" class="workArea">
                            @*@Html.DropDownListFor(model => model.DepartmentId, Model.DepartmentList, "请选择", new { @class = "workArea" })*@
                            <option value="">请选择</option>
                            @foreach (var item in Model.DepartmentList)
                            {
                                <option value="@item.Id" @(Model.DepartmentId.Equals(item.Id) ? "selected" : "") depobj="@(JsonConvert.SerializeObject(item))">
                                    @item.DepartmentName
                                </option>
                            }
                        </select>
                        @Html.CheckBoxFor(x => x.UseDepartmentAddress, new { id = "chkUseDepartmentAddress" }) <text>使用部门联系方式</text>
                    }
                </p>
                <p>
                    <font>*</font><label>工作性质：</label>
                    @foreach (var item in Model.JobTypeList)
                    {
                        @Html.RadioButtonFor(model => model.JobType, item.Value, new { @name = "jobType" }) @item.Name <text>&nbsp;</text>
                    }
                </p>
                <p>
                    <font>*</font><label>招聘人数：</label>@Html.TextBoxFor(model => model.Wants, new { @class = "number", maxlength = "5" })@Html.ValidationMessageFor(model => model.Wants)<span>填写0表示招聘人数为“若干”</span>
                </p>
                <p>
                    <font>*</font><label style="vertical-align: top;">岗位职责：</label>@Html.TextAreaFor(model => model.Responsibilities)@Html.ValidationMessageFor(model => model.Responsibilities)<br />
                    <span class="lanage">(不超过4000汉字字符或者英文字符)</span>
                </p>
            </div>
        </div>
        <div class="rzyq">
            <div class="rzyq_Title">
                任职要求
            </div>
            <div class="rzyq_box">
                <div class="rzyq_box_Top">
                    <div class="rzyq_box_Top_left">
                        <p>
                            <font>*</font><label>学历要求：</label>@Html.DropDownListFor(model => model.EducationLevel, Model.EducationLevelList, "请选择", new { @class = "workArea" })
                            @Html.ValidationMessageFor(model => model.EducationLevel)
                            @Html.CheckBoxFor(model => model.RecruiteGraduates) 允许应届毕业生应聘
                        </p>
                        <p>
                            <font>&nbsp;</font><label>年龄要求：</label>
                            @Html.DropDownListFor(model => model.MinAge, Model.AgeList, "请选择")
                            -
                            @Html.DropDownListFor(model => model.MaxAge, Model.AgeList, "请选择")周岁
                        </p>
                        <p>
                            <font>&nbsp;</font><label>专业要求：</label>
                            @Html.DropDownListFor(model => model.Major, Model.MajorList, "请选择", new { @class = "workArea" })
                        </p>
                    </div>
                    <div class="rzyq_box_Top_right">
                        <p>
                            <font>*</font><label>工作经验：</label>@Html.DropDownListFor(model => model.YearsOfExperience, Model.YearsOfExperienceList, "请选择", new { @class = "workArea" })及以上
                            @Html.ValidationMessageFor(model => model.YearsOfExperience)
                        </p>
                        <p>
                            <font>&nbsp;</font><label>性别要求：</label>
                            @foreach (var item in Model.GenderList)
                            {
                                @Html.RadioButtonFor(model => model.Gender, item.Value, new { @name = "jobType" }) @item.Name
                                @:&nbsp;
                            }
                            <input type="radio" id="Gender" name="Gender" value="" @(!Model.Gender.HasValue ? "checked" : "")> 不限
                        </p>
                        <p>
                            <font>&nbsp;</font><label>语言要求：</label>@Html.DropDownListFor(model => model.Language, Model.LanguageList, "请选择")
                            <label class="shulian">
                                熟练程度：
                            </label>@Html.DropDownListFor(model => model.LanguageLevel, Model.LanguageLevelList, "请选择")
                        </p>
                    </div>
                    <div class="cl">
                    </div>
                </div>
                <p>
                    <label style="vertical-align: top;">任职要求：</label>@Html.TextAreaFor(model => model.Qualifications)<br />
                    <span class="lanage">(不超过4000汉字字符或者英文字符)</span>
                </p>
            </div>
        </div>
        <div class="xcfl">
            <div class="xcfl_title">
                薪酬福利
            </div>
            <div class="xcfl_box">
                <p>
                    <label>
                        <font style="color: #F00">*</font>薪酬范围：
                    </label>@Html.DropDownListFor(model => model.SalaryRange, Model.SalaryRangeList, "请选择", new { @class = "workArea" }) 元/月 @Html.ValidationMessageFor(model => model.SalaryRange)
                </p>
                <p>
                    <label>
                        <font style="color: #F00">*</font>具体金额：
                    </label>@Html.TextBoxFor(model => model.MonthlySalary, new { @class = "number" })@Html.ValidationMessageFor(model => model.MonthlySalary)
                    @Html.CheckBoxFor(x => x.IsOpenSalaryRange) 允许求职者查看
                </p>
                <p>
                    <label style="vertical-align: top;">
                        其他福利待遇：
                    </label>@Html.TextAreaFor(model => model.Welfare, new { @class = "pay_textarea", maxlength = "200" })@Html.ValidationMessageFor(model => model.Welfare)<br />
                    <span class="lanage">(不超过200汉字字符或者英文字符)</span>
                </p>
            </div>
        </div>
        <div class="lxfs">
            <div class="lxfs_title">
                联系方式
            </div>
            <div class="lxfs_box">
                <div class="lxfs_box_form">
                    <p>
                        <label>
                            联系人：
                        </label>@Html.TextBoxFor(model => model.Contact, new { @class = "contact_input", id = "txtContact" })
                    </p>
                    <p>
                        <label>
                            电话号码：
                        </label>@Html.TextBoxFor(model => model.Tel, new { @class = "contact_input", id = "txtTel" })
                    </p>
                    <p>
                        <label>
                            传真：
                        </label>@Html.TextBoxFor(model => model.Fax, new { @class = "contact_input", id = "txtFax" })
                    </p>
                    <p>
                        <label>
                            电子邮箱：
                        </label>@Html.TextBoxFor(model => model.Email, new { @class = "mail_input", id = "txtEmail" })
                        @Html.CheckBoxFor(x => x.IsReceivedEmail) 接收求职邮件
                    </p>
                    <p>
                        <label>
                            通讯地址：
                        </label>@Html.TextBoxFor(model => model.Address, new { @class = "address_input" })<strong>邮编：@Html.TextBoxFor(model => model.PostalCode, new { @class = "code_input" })</strong>
                    </p>
                </div>
                <div class="tips">
                    说明：<br />
                    默认为企业的联系方式，如果您需要使用部门联系方式，在选择招聘部门时，确认使用部门联系方式。
                </div>
                <div class="cl">
                </div>
            </div>
        </div>
        <br />
        <div style="text-align: center; width: 100%">
            <label>
                职位有效期：
            </label>@Html.DropDownListFor(item => item.DateRage, Model.DateRageList,
                new { id = "ddlDateRage", @class = "workArea", style = Model.Status == (int)JobQueryStatus.Active ? "display:none" : "display:inline" })
            截止日期:<label id="lblValidDate">@Model.EndDateDisplay</label>
        </div>
    </div>
</div>
@Html.ValidationSummary(true)
